package com.miracle.java2110.controller;


import com.miracle.java2110.common.PageVo;
import com.miracle.java2110.common.R;
import com.miracle.java2110.pojo.RoomManager;
import com.miracle.java2110.service.RoomService;
import com.miracle.java2110.vo.BarPo;
import com.miracle.java2110.vo.BarVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author ZhaoHaoRen
 *
 * @function 房间管理
 */
@CrossOrigin("*")
@RestController
@RequestMapping("/room")
public class RoomController {
    @Autowired
    private RoomService roomService;

    @RequestMapping("/pageData")
    public PageVo<RoomManager> pageData(@RequestParam Map<String,Object> map) {
        return  roomService.pageData(map);
    }

    @RequestMapping("/add")
    public R add(RoomManager roomManager) {
        return roomService.add(roomManager);
    }

    @RequestMapping("/multiDelete")
    public R multiDelete(@RequestBody  List<RoomManager> list) {
        return roomService.multiDelete(list);
    }

    @RequestMapping("/edit")
    public R edit(RoomManager roomManager) {
        return roomService.edit(roomManager);
    }

    @RequestMapping("/delete")
    public R delete(Integer id) {
        return roomService.delete(id);
    }

    @RequestMapping("/histogram")
    public BarPo selectHistogram() {return roomService.selectHistogram();}

    @RequestMapping("/pie")
    public List<BarVo> selectPie() {return roomService.selectPie();}

}
